<template>
  <div class="header">
      <div class="header-left iconfont">&#xe624;</div>
      <div class="header-input">
        <span class="iconfont">&#xe632;</span>
        输入城市/游玩</div>
      <router-link to="/city">
        <div class="header-right">{{this.city}}
          <span class="iconfont">&#xe62d;</span>
        </div>
      </router-link>

  </div>

</template>

<script>
import { mapState } from 'vuex'
export default {
  name: 'HomeHeader',
  computed: {
    ...mapState(['city']) /* mapState是指把vuex里面的数据 映射到这个组件的computed的计算属性里，把city这个公用数据映射到名字叫做city的计算属性中 */
  }
}
</script>

<style scoped>
    .header {
      font-size: .24rem;
      display: flex;
      height: 0.86rem;
      line-height: .86rem;
      background: #00bcd4;
      color :#fff;
    }
    .header-left {
      width: .64rem;
      float :left;
    }
    .header-input {
      flex: 1;
      height: 0.64rem;
      margin-top: .12rem;
      margin-left: .2rem;
      background-color: #fff;
      border-radius: .1rem;
      color: #ccc;
      line-height: .64rem;
      padding: 0 .1rem;
    }
    .header-right {
      padding: 0 .25rem;
      float :right;
      text-align: center;
      color: #fff;
    }
</style>
